package com.mspbots.common.exceptions;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * com.mspbots.web.BaseWebClient
 *
 * @author Alex bob(https://github.com/vnobo)
 * @date Created by 2019/8/26
 */
@Data
@EqualsAndHashCode(callSuper=false)
public class RestServerException extends RuntimeException implements Serializable {

    private int code;
    private String msg;

    public RestServerException(String message) {
        super(message);
        this.msg = message;
    }

    public RestServerException(String message, Throwable cause) {
        super(message, cause);
        this.msg = message;
    }

    public RestServerException(int code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public RestServerException(int code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
        this.msg = message;
    }

    public RestServerException(Throwable cause) {
        super(cause);
        this.msg = cause.getMessage();
    }

    public RestServerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.msg = message;
    }
}
